using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Joy.Erp.BasicArchives.Core.Filters;

namespace Joy.Erp.BasicArchives.Receipt
{
    [RemoteService(Name = BasicArchivesRemoteServiceConsts.RemoteServiceName)]
    [Area(BasicArchivesRemoteServiceConsts.ModuleName)]
    [ControllerName("Receivement")]
    [Route("api/basic-archives/receivement")]
    public partial class ReceivementController : BasicArchivesController, IReceivementAppService
    {
        protected IReceivementAppService ReceivementAppService => LazyServiceProvider.LazyGetRequiredService<IReceivementAppService>();

        [HttpGet]
        [Route("{id}")]
        public Task<ReceivementDto> GetAsync(Guid id)
        {
            return ReceivementAppService.GetAsync(id);
        }

        [HttpGet]
        [Route("child/{id}")]
        public Task<ReceivementLineDto> GetChildAsync(Guid id)
        {
            return ReceivementAppService.GetChildAsync(id);
        }

        [HttpGet]
        [Route("find")]
        public Task<ReceivementDto> FindAsync(string filter)
        {
            return ReceivementAppService.FindAsync(filter);
        }

        [HttpGet]
        [Route("find-by-source-key")]
        public Task<ReceivementDto> FindBySourceKeyAsync(string sourceKey, string sourceType)
        {
            return ReceivementAppService.FindBySourceKeyAsync(sourceKey, sourceType);
        }

        [HttpGet]
        public Task<PagedResultDto<ReceivementDto>> GetListAsync(FilterRequestDto input)
        {
            return ReceivementAppService.GetListAsync(input);
        }

        [HttpPost]
        [Route("query")]
        public Task<PagedResultDto<ReceivementDto>> QueryAsync(FilterGroupRequestDto input)
        {
            return ReceivementAppService.QueryAsync(input);
        }

        [HttpPost]
        [Route("query-children")]
        public Task<PagedResultDto<ReceivementLineDto>> QueryChildrenAsync(FilterGroupRequestDto input)
        {
            return ReceivementAppService.QueryChildrenAsync(input);
        }

        [HttpPost]
        public Task<ReceivementDto> CreateAsync(ReceivementCreateDto input)
        {
            return ReceivementAppService.CreateAsync(input);
        }

        [HttpPut]
        [Route("{id}")]
        public Task<ReceivementDto> UpdateAsync(Guid id, ReceivementUpdateDto input)
        {
            return ReceivementAppService.UpdateAsync(id, input);
        }

        [HttpPost]
        [Route("submit")]
        public Task<ReceivementDto> SubmitAsync(Guid id)
        {
            return ReceivementAppService.SubmitAsync(id);
        }

        [HttpPost]
        [Route("approve")]
        public Task<ReceivementDto> ApproveAsync(Guid id)
        {
            return ReceivementAppService.ApproveAsync(id);
        }

        [HttpPost]
        [Route("unapprove")]
        public Task<ReceivementDto> UnApproveAsync(Guid id)
        {
            return ReceivementAppService.UnApproveAsync(id);
        }

        [HttpDelete]
        [Route("{id}")]
        public Task DeleteAsync(Guid id)
        {
            return ReceivementAppService.DeleteAsync(id);
        }

        [HttpPost]
        [Route("batch-create")]
        public Task<List<ReceivementDto>> BatchCreateAsync(List<ReceivementCreateDto> inputs, bool useBulk = false)
        {
            return ReceivementAppService.BatchCreateAsync(inputs, useBulk);
        }

        [HttpPut]
        [Route("batch-update")]
        public Task<List<ReceivementDto>> BatchUpdateAsync(List<ReceivementBatchUpdateDto> inputs, bool useBulk = false)
        {
            return ReceivementAppService.BatchUpdateAsync(inputs, useBulk);
        }

        [HttpPost]
        [Route("batch-delete")]
        public Task BatchDeleteAsync(List<Guid> ids, bool useBulk = false)
        {
            return ReceivementAppService.BatchDeleteAsync(ids, useBulk);
        }
    }
} 